<?php
/**
 * 模块控制器
 * 
 * 提供一些操作模块的基本方法，所有安装程序和卸载程序都应该继承该类
 *
 * @package if
 * @subpackage installer
 * @since 1.1.2
 */
class IModuleController extends IController {
	protected $_helper = false;
	
	/**
	 * Enter description here...
	 *
	 * @var IModule
	 */
	protected $module;
	/**
	 * Enter description here...
	 *
	 * @var IModuleManager
	 */
	protected $manager;
	
	/**
	 * 设置模块对象
	 *
	 * @param IModule $module
	 * @since 1.1.2
	 */
	function setModule(IModule $module) {
		$this->module = $module;
	}
	
	function _init() {
		$this->manager = IModuleManager::singleton();
		parent::_init();
	}
	
	function _before() {
		if (!$this->module) {
			exit("module have been installed");
		}
		$this->setViewDirectory($this->module->dir() . "/_deploy/views/%{locale}/templates");
	}
	
	protected function register() {
		$this->manager->register($this->module);
	}
	
	protected function unRegister() {
		$this->manager->unRegister($this->module);
	}

	protected function skip() {
		$this->manager->skip($this->module);
	}	
}

?>